<div class="page">
	<?php echo $this->Form->create('Grupo', array('class' => 'form-horizontal'));?>
	<div class="page-header">
		<h3><i class="icon-awesome-pencil icon-large"></i><span class="divider"></span><?php echo __('Grupos');?>&nbsp;<small><?php echo ('Editar Grupos dos Produtos');?></small></h3>
		<button type="button" class="close" data-dismiss="modal">×</button>
	</div>
	<div class="page-content">
		<fieldset>
			<legend><?php echo __('Editar Grupo'); ?></legend>
			<div class="control-group">
				<?php echo $this->Form->Label('conta_contabil_id', 'Conta Contábil', array('class' => 'control-label'));	?>
				<div class="controls">
					<?php echo $this->Form->input('conta_contabil_id', array('options' => $contaContabils, 'empty' => 'Selecione', 'label' => false, 'div' => false, 'class' => 'span11'));	?>
				</div>
			</div>
			<div class="control-group">
				<?php echo $this->Form->Label('grupo', 'Grupo', array('class' => 'control-label'));	?>
				<div class="controls">
					<?php echo $this->Form->input('grupo', array('type' => 'text', 'label' => false, 'div' => false, 'class' => 'span11'));	?>
				</div>
			</div>
			<div class="control-group">
				<?php echo $this->Form->Label('vida_util', 'Vida útil', array('class' => 'control-label'));	?>
				<div class="controls">
					<?php echo $this->Form->input('vida_util', array('id' => 'amount-anos', 'class' => 'span2 amount', 'type' => 'text', 'label' => false, 'div' => false));	?>
					<p><div id="slider-range-min-anos"></div></p>
				</div>
			</div>
			<div class="control-group">
				<?php echo $this->Form->Label('percentual_residual', 'Percentual Residual', array('class' => 'control-label'));	?>
				<div class="controls">
					<?php echo $this->Form->input('percentual_residual', array('id' => 'amount-percentual', 'class' => 'span2 amount', 'type' => 'text', 'label' => false, 'div' => false));	?>
					<p><div id="slider-range-min-percentual"></div></p>
				</div>
			</div>
		</fieldset>
	</div>
   <div class="page-footer">
   		<?php echo $this->Form->button('<i class="icon-awesome-signout icon-large"></i> Fechar', array('type' => 'button', 'div' => false, 'class' => 'btn', 'data-dismiss' => 'modal')); ?>
		<?php echo $this->Form->button('<i class="icon-awesome-save icon-large icon-white"></i> Salvar', array('div' => false, 'class' => 'btn btn-primary', 'escape' => false)); ?>
   </div>
   <?php echo $this->Form->end();?>
</div>

<script type="text/javascript">
    $(function() {
        
        $( "#slider-range-min-anos" ).slider({
            range: "min",
            value: 5,
            min: 1,
            max: 100,
            slide: function( event, ui ) {
                $( "#amount-anos" ).val(ui.value + " anos");
            }
        });
        
        $( "#slider-range-min-percentual" ).slider({
            range: "min",
            value: 5,
            min: 1,
            max: 100,
            slide: function( event, ui ) {
                $( "#amount-percentual" ).val(ui.value + "%");
            }
        });

        if ($( "#amount-anos" ).val() != '') {
        	$( "#slider-range-min-anos" ).slider("option", "value", $( "#amount-anos" ).val());
        }

        if ($( "#amount-percentual" ).val() != '') {
        	$( "#slider-range-min-percentual" ).slider("option", "value", $( "#amount-percentual" ).val());
        }

        $( "#amount-anos" ).val( $( "#slider-range-min-anos" ).slider( "value" ) + " anos" );
        $( "#amount-percentual" ).val( $( "#slider-range-min-percentual" ).slider( "value" ) + "%" );
    });
</script>